{-# OPTIONS -Wall #-}

module B6 where

import Lirio.Base.Duration
import Lirio.Base.Pitch
import Lirio.Base.Overloading
import Lirio.PitchNames
import Lirio.RelPitch
import Lirio.Score
import Lirio.ScoreDoc

import Data.Monoid
import System.Cmd

demo01 = execScore $ notelist $ do 
   rest dQuarter >> beaml (note middle_c dEighth) 
                 >> beamr (note middle_c dEighth) 

main = do 
    writeFile "bulgarian6.ly" (renderDoc80 doc)
    system    "lilypond bulgarian6.ly"
  where 
    doc    = execScore score_B6 
       

score_B6 :: Score ()
score_B6 = version "2.12.2"
        <$> score 
        <+> block (relative middle_c 
                            (block (     key a_ <+> major
                                     <$> time 2 4
                                     <$> clef "treble" 
                                     <$> notelist notelist_B6
                                     )))


notelist_B6 :: NoteList ()
notelist_B6 = bar1 <> bar2
  where
    note16  = note `flip` dSixteenth
    bar1    =  beam (sequence_ $ map note16 $ [ a_4,  b_4, cs_5, cs_5 ])
            >> beam (sequence_ $ map note16 $ [ cs_5, a_4, cs_5, cs_5 ])

    bar2    =  beam (sequence_ $ map note16 $ [ cs_5, a_4, b_4, cs_5 ])
            >> beam (sequence_ $ map note16 $ [ b_4,  a_4, a_4])
            >> rest dSixteenth
          
